// $_FILEHEADER_BEGIN ***************************
// 版权声明:Timer
// Copyright © 2015 - Timer All Rights Reserved
// 文件名称: ARReasonCell.m
// 创建日期: 15/12/13
// 创 建 人: 甄鑫
// 文件说明: <#content#>
// $_FILEHEADER_END ******************************


#import "ARReasonCell.h"
#import "NavStatus.h"
#import "ReasonInfoVC.h"

@implementation ARReasonCell
{
    NSString *reasonStr;
    NSString *useridStr;

}
- (void)awakeFromNib {
    // Initialization code
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showReasonInfoVC)];
    self.userInteractionEnabled = YES;
    [self addGestureRecognizer:tap];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)setData:(id)data
{
    ARCellModel *model = (ARCellModel *)data;
    if ([model.cellBaseType integerValue] == 0) {
        self.reasonLine.hidden = NO;
    }else{
        self.reasonLine.hidden = YES;
    }
    NSString *reason = [NSString stringWithFormat:@"借款理由：%@",[model.data summary]];
    NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:reason];
    [str addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0, 5)];
    [str addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(5, str.length-5)];
    self.reasonLabel.attributedText = str;
    
    useridStr = [model.data localid];
    reasonStr = [model.data summary];
}
- (void)reSet
{
    
}
- (id)getData
{
    return nil;
}
- (void)setDelegate:(id)delegate
{
    
}
- (void)showReasonInfoVC{
    UINavigationController *nav = [[NavStatus sharedInstance] getCurVC].navigationController;
    ReasonInfoVC *infovc = [[ReasonInfoVC alloc] init];
    infovc.reason = reasonStr;
    infovc.userid = useridStr;
    [infovc setHidesBottomBarWhenPushed:YES];
    [nav pushViewController:infovc animated:YES];
}
@end
